class Thread5 implements Runnable {
    private int a;
    private static int sum = 0;
    private String name;

    public Thread5(int a, String name) {
        this.a = a;
        this.name = name;
    }

    @Override
    public void run() {
        for (int i = 1; i <= 10; i++) {
            sum += a;
            a++;
        }
        System.out.println(name + "线程相加完后的值为：" + sum);
    }
}

public class T5 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(new Thread5(1, "A"));
        Thread t2 = new Thread(new Thread5(11, "B"));
        Thread t3 = new Thread(new Thread5(21, "C"));
        Thread t4 = new Thread(new Thread5(31, "D"));
        Thread t5 = new Thread(new Thread5(41, "E"));
        Thread t6 = new Thread(new Thread5(51, "F"));
        Thread t7 = new Thread(new Thread5(61, "G"));
        Thread t8 = new Thread(new Thread5(71, "H"));
        Thread t9 = new Thread(new Thread5(81, "I"));
        Thread t10 = new Thread(new Thread5(91, "J"));
        t1.start();
        Thread.sleep(100);
        t2.start();
        Thread.sleep(100);
        t3.start();
        Thread.sleep(100);
        t4.start();
        Thread.sleep(100);
        t5.start();
        Thread.sleep(100);
        t6.start();
        Thread.sleep(100);
        t7.start();
        Thread.sleep(100);
        t8.start();
        Thread.sleep(100);
        t9.start();
        Thread.sleep(100);
        t10.start();
    }
}
